using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.ApplicationBlocks.Data;
using System.Data.SqlClient;
using System.Configuration;

namespace DataHelper.DAL
{
    public class webpages_UsersInRoles
    {
private static  string m_trConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;

       #region webpages_UsersInRolesSelectAll
        public static SqlDataReader webpages_UsersInRolesSelectAll(string strSearch="",int top = 1, int bottom = 20, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
                return SqlHelper.ExecuteReader(ConnectionString, "webpages_UsersInRolesSelectAllRows",strSearch,top,bottom);
            return SqlHelper.ExecuteReader(m_trConnectionString, "webpages_UsersInRolesSelectAllRows",strSearch,top,bottom);
        }
        #endregion
       #region webpages_UsersInRolesSelectRow
        public static SqlDataReader webpages_UsersInRolesSelectRow(int UserId, int RoleId, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
                return SqlHelper.ExecuteReader(ConnectionString, "webpages_UsersInRolesSelectRow", UserId, RoleId);
            return SqlHelper.ExecuteReader(m_trConnectionString, "webpages_UsersInRolesSelectRow", UserId, RoleId);
        }
        #endregion
       #region webpages_UsersInRolesSelectRowByForeignKey_UserId
        public static SqlDataReader webpages_UsersInRolesSelectRowByForeignKey_UserId(int UserId, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
                return SqlHelper.ExecuteReader(ConnectionString, "webpages_UsersInRolesSelectRowByForeignKey_UserId", UserId);
            return SqlHelper.ExecuteReader(m_trConnectionString, "webpages_UsersInRolesSelectRowByForeignKey_UserId", UserId);
        }
        #endregion
       #region webpages_UsersInRolesSelectRowByForeignKey_RoleId
        public static SqlDataReader webpages_UsersInRolesSelectRowByForeignKey_RoleId(int RoleId, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
                return SqlHelper.ExecuteReader(ConnectionString, "webpages_UsersInRolesSelectRowByForeignKey_RoleId", RoleId);
            return SqlHelper.ExecuteReader(m_trConnectionString, "webpages_UsersInRolesSelectRowByForeignKey_RoleId", RoleId);
        }
        #endregion
       #region webpages_UsersInRolesSelectRowByForeignKey_UserId_RoleId
        public static SqlDataReader webpages_UsersInRolesSelectRowByForeignKey_UserId_RoleId(int UserId, int RoleId, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
                return SqlHelper.ExecuteReader(ConnectionString, "webpages_UsersInRolesSelectRowByForeignKey_UserId_RoleId", UserId, RoleId);
            return SqlHelper.ExecuteReader(m_trConnectionString, "webpages_UsersInRolesSelectRowByForeignKey_UserId_RoleId", UserId, RoleId);
        }
        #endregion
       #region webpages_UsersInRolesInsertRow
        public static void webpages_UsersInRolesInsertRow(int UserId, int RoleId, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
            {
                SqlHelper.ExecuteNonQuery(ConnectionString, "webpages_UsersInRolesInsertRow", UserId, RoleId);
                return;
            }
            SqlHelper.ExecuteNonQuery(m_trConnectionString, "webpages_UsersInRolesInsertRow", UserId, RoleId);
        }
        #endregion
       #region webpages_UsersInRolesUpdateRow
        public static void webpages_UsersInRolesUpdateRow(int UserId, int RoleId, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
            {
                SqlHelper.ExecuteNonQuery(ConnectionString, "webpages_UsersInRolesUpdateRow", UserId, RoleId);
                return;
            }
            SqlHelper.ExecuteNonQuery(m_trConnectionString, "webpages_UsersInRolesUpdateRow", UserId, RoleId);
        }
        #endregion
       #region webpages_UsersInRolesDeleteRow
        public static void webpages_UsersInRolesDeleteRow(int UserId, int RoleId, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
            {
                SqlHelper.ExecuteNonQuery(ConnectionString, "webpages_UsersInRolesDeleteRow", UserId, RoleId);
                return;
            }
            SqlHelper.ExecuteNonQuery(m_trConnectionString, "webpages_UsersInRolesDeleteRow", UserId, RoleId);
        }
        #endregion

    }
}

